"use strict";
cc._RF.push(module, 'f9ebfXLBahHE7AZCQxnsuye', 'HallVitView');
// scripts/HallVitView.js

"use strict";

var t = require;
var e = module;
var o = exports;

var _i,
    n = void 0 && (void 0).__extends || (_i = function i(t, e) {
  return (_i = Object.setPrototypeOf || {
    __proto__: []
  } instanceof Array && function (t, e) {
    t.__proto__ = e;
  } || function (t, e) {
    for (var o in e) {
      Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o]);
    }
  })(t, e);
}, function (t, e) {
  function o() {
    this.constructor = t;
  }

  _i(t, e), t.prototype = null === e ? Object.create(e) : (o.prototype = e.prototype, new o());
}),
    a = void 0 && (void 0).__decorate || function (t, e, o, i) {
  var n,
      a = arguments.length,
      r = a < 3 ? e : null === i ? i = Object.getOwnPropertyDescriptor(e, o) : i;
  if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(t, e, o, i);else for (var s = t.length - 1; s >= 0; s--) {
    (n = t[s]) && (r = (a < 3 ? n(r) : a > 3 ? n(e, o, r) : n(e, o)) || r);
  }
  return a > 3 && r && Object.defineProperty(e, o, r), r;
};

Object.defineProperty(o, "__esModule", {
  value: !0
});

var r = t("GlobalUserData"),
    s = t("NativeManager"),
    l = t("Util"),
    c = t("Global"),
    d = t("StorageManager"),
    h = t("BaseStorage"),
    p = t("GoldFlyAnim"),
    u = t("HallConstant"),
    f = cc._decorator,
    m = f.ccclass,
    _ = f.property,
    y = function (t) {
  function e() {
    var e = null !== t && t.apply(this, arguments) || this;
    return e.pfb_goldfly = null, e.node_iconvit = null, e.lab_getVit = null, e.lab_times = null, e.btn = null, e.closeNode = null, e.btnClose = null, e.btnShowAd = null, e.videoIcon = null, e.TTVideoIcon = null, e.btnShowVideo = null, e.btnCancel = null, e.btnGet = null, e.mistakeBannerTimer = null, e.nTotalVideo = 20, e._vitControl = null, e.isBtnClickOnce = !1, e;
  }

  return n(e, t), e.prototype.onLoad = function () {
    this.vitNumKey = c.BaseStorageKey.VitNumAvailable, d.StorageManager.setDailyTaskStorageKey(this.vitNumKey), this.lab_times.string = this.getNumber().toString(), this.videoTab = c.VideoTab.dim18, l.Util.videoExposure(this.videoTab);
  }, e.prototype.onClickNativeBanner = function () {
    l.Util.clickNativeBanner(1);
  }, e.prototype.start = function () {
    var t = this;
    this.closeNode.active = !0, this.btnClose.active = !1, this.btnShowAd.active = !1, this.btnShowVideo.active = !1, this.btnCancel.active = !1, l.Util.is_233() && s["default"].instance.showInterstitialAd(), l.Util.is_tt() && (this.videoIcon.active = !1, this.TTVideoIcon.active = !0, l.Util.showBanner(), r["default"].bAuditMode ? (this.btnClose.active = !1, this.btnGet.x = 130, this.btnCancel.active = !0) : (this.btnShowVideo.active = !0, this.btnClose.active = !1, setTimeout(function () {
      t.closeNode.active = !0;
    }, 2e3))), l.Util.hideHallBanner();
    var e = r["default"].nTotalGame % 6;
    l.Util.showNativeBanner(1, this.btnShowAd, function () {
      l.Util.is_qg() && !r["default"].bAuditMode && r["default"].nativeMistakeBannerList[e] && (t.btnClose.active = !1, setTimeout(function () {
        t.closeNode.active = !0;
      }, 2e3));
    }), l.Util.hideSingleCustomAd(), l.Util.is_wx() && (r["default"].bAuditMode || !r["default"].isShowMistakeBanner ? l.Util.showBanner() : this.mistakeBannerTimer = setTimeout(function () {
      l.Util.showMistakeBanner(function () {
        t.mistakeBannerTimer = setTimeout(function () {
          l.Util.hideMistakeBanner(), l.Util.showBanner();
        }, 2e3);
      }, function () {
        l.Util.showBanner();
      });
    }, 1e3));
  }, e.prototype.init = function (t) {
    this._vitControl = t;
  }, e.prototype.onEnable = function () {
    l.Util.show_VerticalCustomAd(!0), l.Util.show_VerticalCustomAd(!1);
  }, e.prototype.onDisable = function () {
    l.Util.hide_VerticalCustomAd(!0), l.Util.hide_VerticalCustomAd(!1);
  }, e.prototype.getNumber = function () {
    var t = this.nTotalVideo - h.BaseStorage.getInt(this.vitNumKey, 0);
    return t <= 0 && (this.btn.interactable = !1), t;
  }, e.prototype.onBtnClose = function () {
    this.isBtnClickOnce || r["default"].bAuditMode || !r["default"].isShowMistakeBanner ? (this.isBtnClickOnce = !1, l.Util.showSingleCustomAd(), clearTimeout(this.mistakeBannerTimer), this._vitControl.playAudio(u.Audio_ID.btn_click), this.node.destroy(), l.Util.hideMistakeBanner(), l.Util.hideBanner(), l.Util.showHallBanner(), l.Util.hideNativeBanner()) : this.isBtnClickOnce = !0;
  }, e.prototype.onBtnVideo = function () {
    var t = this;
    this._vitControl.playAudio(u.Audio_ID.btn_click), r["default"].videoTab = this.videoTab, l.Util.showRewardVideo(function () {
      t.playGetAnim();
    }, null, null, !1);
  }, e.prototype.playGetAnim = function () {
    var t = this;
    r["default"].saveVitData(!0, 20);
    var e = h.BaseStorage.getInt(this.vitNumKey, 0) + 1;
    h.BaseStorage.setInt(this.vitNumKey, e), this.lab_times.string = this.getNumber().toString(), this._vitControl.playAudio(u.Audio_ID.get_gold);

    var o = this._vitControl._hallControl.getVitWorldPos();

    l.Util.AnimFly(p.Fly_Type.vit, this.pfb_goldfly, this.node_iconvit, o, function () {
      t._vitControl.onSetOwnVit(!0);
    }, function () {});
  }, a([_(cc.Prefab)], e.prototype, "pfb_goldfly", void 0), a([_(cc.Node)], e.prototype, "node_iconvit", void 0), a([_(cc.Label)], e.prototype, "lab_getVit", void 0), a([_(cc.Label)], e.prototype, "lab_times", void 0), a([_(cc.Button)], e.prototype, "btn", void 0), a([_(cc.Node)], e.prototype, "closeNode", void 0), a([_(cc.Node)], e.prototype, "btnClose", void 0), a([_(cc.Node)], e.prototype, "btnShowAd", void 0), a([_(cc.Node)], e.prototype, "videoIcon", void 0), a([_(cc.Node)], e.prototype, "TTVideoIcon", void 0), a([_(cc.Node)], e.prototype, "btnShowVideo", void 0), a([_(cc.Node)], e.prototype, "btnCancel", void 0), a([_(cc.Node)], e.prototype, "btnGet", void 0), a([m], e);
}(cc.Component);

o["default"] = y;

cc._RF.pop();